package com.lxp.modules.gyy.domain;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * Approval Request
 *
 * @TableName approval_request
 */
@TableName(value = "approval_request")
@Data
public class ApprovalRequest implements Serializable {
    /**
     *
     */
    @TableId
    private Integer id;

    /**
     * Approval Subject
     */
    private String name;

    @TableField(exist = false)
    private String title;

    /**
     * Category
     */
    private Integer categoryId;
    @TableField(exist = false)
    private String categoryName;
    /**
     * Date start
     */
    private Date dateStart;

    /**
     * Date end
     */
    private Date dateEnd;

    /**
     * Date Confirmed
     */
    private Date dateConfirmed;

    /**
     * Amount
     */
    private Double amount;

    /**
     * Description
     */
    private String reason;

    /**
     * Request Status
     */
    private String requestStatus;

    /**
     * Created by
     */
    private Integer createUid;

    /**
     * Created on
     */
    private Date createDate;

    /**
     * 当前审批阶段
     */
    private Integer approvalNow;

    /**
     * 请假类型
     */
    private String leaveCategory;

    @TableField(exist = false)
   private List<IrAttachment> attachmentList;

    @TableField(exist = false)
    private List<ApprovalApprover> approverList;


    public Date getCreateDate() {
        return DateUtil.offsetHour(createDate, 8);
    }

    public Date getDateStart() {
        if (dateStart != null) {
            return DateUtil.offsetHour(dateStart, 8);
        }
        return null;
    }

    public Date getDateEnd() {
        if (dateEnd != null) {
            return DateUtil.offsetHour(dateEnd, 8);
        }
        return null;
    }

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}